#!/usr/bin/env python3.10
# -*- encoding: utf-8 -*-
"""
@File    :   models.py
@Time    :   2024/01/02 09:56:03
@Author  :   windstarry 
@Version :   1.0
"""
# here put the import lib
from django.db import models
from big_event import settings


class CoreModel(models.Model):
    """
    核心标准抽象模型模型,可直接继承使用
    """

    id = models.BigAutoField(primary_key=True, help_text="Id", verbose_name="Id")
    remark = models.CharField(
        max_length=255, verbose_name="描述", null=True, blank=True, help_text="描述"
    )
    creator = models.ForeignKey(to=settings.AUTH_USER_MODEL, related_query_name='creator_query', null=True,
                                verbose_name='创建人', help_text="创建人", on_delete=models.SET_NULL, db_constraint=False)
    modifier = models.CharField(max_length=255, null=True, blank=True, help_text="修改人", verbose_name="修改人")
    update_datetime = models.DateTimeField(
        auto_now=True, null=True, blank=True, help_text="修改时间", verbose_name="修改时间"
    )
    create_datetime = models.DateTimeField(
        auto_now_add=True, null=True, blank=True, help_text="创建时间", verbose_name="创建时间"
    )
    sort = models.IntegerField(
        default=1, null=True, blank=True, verbose_name="显示排序", help_text="显示排序"
    )

    class Meta:
        abstract = True
        verbose_name = "核心模型"
        verbose_name_plural = verbose_name
